﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System;

namespace MyEditor 
{
    /// <summary>
    /// 提示弹窗封装
    /// </summary>
    public class MessageShow 
    {
        /// <summary>
        /// 提示窗
        /// </summary>
        public static void ShowMessage(string title,string msg)
        {
            EditorUtility.DisplayDialog(title,msg,"确定");
        }

        /// <summary>
        /// 普通操作提示窗
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="obj"></param>
        public static void ShowNote( string msg, UnityEngine.Object obj = null )
		{
			Debug.Log( msg, obj );
			ShowMessage("注意", msg);
		}

        /// <summary>
        /// 错误提示窗
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="obj"></param>
        public static void ShowError( string msg, UnityEngine.Object obj = null )
		{
			Debug.LogError( msg,obj);
			ShowMessage("错误", msg);
		}

        /// <summary>
        /// 确认弹窗(是，否)
        /// </summary>
        public static void ShowBox(string msg,Action enterEvent,Action cancleEvent,string enterStr = "是",string cancleStr = "否")
        {
            if (EditorUtility.DisplayDialog("", msg, enterStr, cancleStr))
            {
                enterEvent();
            }
            else
            {
                cancleEvent();
            }
        }

    }

}
